<?php
class Admin_Form_FeatureDetail extends Zend_Form {

	public function __construct($options = null) {
		parent::__construct ( $options );
		
		$titleVi = new Zend_Form_Element_Text ( 'titleVi' );
		$titleVi->addFilter ( 'StringTrim' )
			->setRequired ( true )
			->addValidator ( 'NotEmpty' )
			->setAttrib ( 'placeholder', 'Ví dụ: Màu trắng, Size M,...' )
			->setAttrib ( 'style', 'width:95%;' )
			->setDecorators ( array (
				'ViewHelper' 
		) );
		
		$value = new Zend_Form_Element_Text ( 'value' );
		$value->addFilter ( 'StringTrim' )
			->setAttrib ( 'placeholder', 'Nhập mã màu khi chọn thuộc tính màu sắc: #FFFFFF' )
			->setAttrib ( 'style', 'width:90%;' )
			->setDecorators ( array (
				'ViewHelper' 
		) );
			
		$featureId = new Zend_Form_Element_Hidden('featureId');
		$featureId->addFilter('StringTrim')
			->setRequired(true)
			->setValue($options['featureId'])
			->setDecorators ( array (
					'ViewHelper'
			) );
			
		$categoryId = new Zend_Form_Element_Select('categoryId');
		$categoryId->addFilter('StringTrim')
			->setAttrib ( 'class', 'form-control chzn-select' )
			->setAttrib ( 'style', 'width:95%;' )
			->setMultiOptions($options['category'])
			->setRequired(true)
			->setDecorators ( array (
				'ViewHelper' 
			) );
			
		$weight = new Zend_Form_Element_Text ( 'weight' );
		$weight->addFilter ( 'StringTrim' )
			->addFilter ( 'Int' )
			->addValidator ( 'NotEmpty' )
			->setAttrib ( 'class', 'adminInput' )
			->setAttrib ( 'style', 'width:30%;' )
			->setValue ( '999' )
			->setDecorators ( array (
				'ViewHelper' 
		) );
		
		$status = new Zend_Form_Element_Radio ( 'status' );
		$status->addFilter('StringTrim')	
		->setAttrib ( 'class', 'grey' )
		->setOptions(array('label_class' => 'radio-inline'))	
		->setMultiOptions(array('1' => " Có", '0' => ' Không'))
		->setValue('1')		
		->setDecorators ( array (
				'ViewHelper'
		) );
		
		$arrElement = array (
				$titleVi,
				$value,
				$featureId,
				$categoryId,
				$weight,
				$status 
		);
		
		if (ENGLISH == 1) {
			$titleEn = new Zend_Form_Element_Text ( 'titleEn' );
			$titleEn->addFilter ( 'StringTrim' )
				->setRequired ( true )
				->addValidator ( 'NotEmpty' )
				->setAttrib ( 'style', 'width:95%;' )
				->setDecorators ( array (
					'ViewHelper' 
			) );
			
			$arrElement [] = $titleEn;
		}
		
		$this->addElements ( $arrElement );
	}
}
